#ifndef CLIENTBACKEND_H
#define CLIENTBACKEND_H

#include "baseCTF.h"


// -this is the interface used to communicate between the front end and
//   back end of a client; the front end calls into this to:
//   1. retrieve game state information
//   2. (attempt to) execute a player move
//   3. provide callbacks for receiving notice of updates
// -each client is associated with a player
class ClientBackEnd
{
public:
	int getNumPlayers() const;
	int getPlayerID() const;
	std::string getPlayerName(int playerID) const;
	int getGridType() const;

	int getNumCampers(int playerID) const;
	std::string getCamperName(int playerID, int camperID) const;
	GridPos getPosition(int playerID, int camperID) const;
	int getMovementPoints(int playerID, int camperID) const;
	bool isJailed(int playerID, int camperID) const;

	int getTileTerrain(const GridPos& tile) const;
	// whether a tile has an impassible border on one side (based on terrain,
	//  obstacles, etc.)
	bool canEnterTile(const GridPos& tile, int dir) const;
	bool canExitTile(const GridPos& tile, int dir) const;
	// whether a particular camper can currently pass a tile border, based on not just
	//  terrain/obstacles, but also team membership, abilities, items carried, whatever
	bool canEnterTile(const GridPos& tile, int dir, int playerID, int camperID) const;
	bool canExitTile(const GridPos& tile, int dir, int playerID, int camperID) const;


	// get the current time position of this client's game state
	unsigned int getTimePos() const;
	bool isAtEnd() const;
	Turn getCurrentTurn() const;

	// get the most up-to-date turn information in real time; that is, whose turn
	//  it is in actual real life, which is different from the turn shown in the game
	//  state if the user is currently rewinding to study past moves
	Turn getRealTurn() const;

	// set the current time position of this client's game state
	bool setTimePos(unsigned int pos);
	void advanceToEnd();
	bool seekToStartOfTurn(const Turn& t);
	bool seekToEndOfTurn(const Turn& t);

};


#endif // CLIENTBACKEND_H